<extend name="Public:base" />

<block name="content">
	
<div class="page-header">
	<a href="{:U('Member/add')}" class="btn btn-primary">新增用户</a>
</div>		
	
<table class="table table-striped table-bordered table-hover search-form">
	<thead>
		<th><input name="name" type="text" placeholder="输入用户名" value="{:I('name')}" /></th>
		<th><input name="email" type="text" placeholder="输入邮箱" value="{:I('email')}" /></th>
		<th><input name="tel" type="text" placeholder="输入手机号码" value="{:I('tel')}" /></th>
		<th>
			<a class="btn btn-primary" href="javascript:;" id="search" url="{:U('Member/index')}">查询</a>
		</th>
	</thead>
</table>	
	
<div class="row">
	<div class="col-xs-12">	
		<div class="table-responsive">
			<table class="table table-striped table-bordered table-hover">
				<thead>
					<tr>											
						<th>用户名</th>
						<th>邮箱</th> 
						<th>手机号码</th>  
						<th>登录次数</th>
						<th>登录IP</th>
						<th>创建时间</th>
						<th>最后登录</th>
						<th>状态</th>
						<th>操作</th>				
					</tr>
				</thead>
				<tbody>
						<volist name="list" id="m" empty="$empty">
						<tr>							
							<td>{$m.uname}</td>
							<td>{$m.email}</td>
							<td>{$m.telephone}</td>
							<td>{$m.login_count}</td>
							<td>{$m.last_ip_region}</td>
							
							<td><?php echo empty($m['create_time'])?'无':date('Y-m-d H:i:s',$m['create_time']); ?></td>
							
							<td><?php echo empty($m['last_login_time'])?'无':date('Y-m-d H:i:s',$m['last_login_time']); ?></td>
							<td>
								<?php
								switch($m['status']){
									case '1':
									echo '<span class="green bold">启用</span>';
									break;
									case '0':
									echo '<span class="red bold">禁用</span>';
									break;
								}
								?>
							</td>
							<td>
								<a  class="btn btn-xs btn-info" href='{:U("Member/info",array("id"=>$m["member_id"]))}'>
									<i class="icon-eye-open bigger-120"></i>
								</a> 
							</td>
						</tr>
						</volist>	
						
						<tr>
							<td colspan="20" class="page">{$page}</td>
						</tr>
				</tbody>
				
			</table>
		</div>
	</div>
</div>
</block>
<block name="javascript">
<script>
$(function(){
	
	$("#search").click(function () {
        var url = $(this).attr('url');
        var query = $('.search-form').find('input,select').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
        query = query.replace(/^&/g, '');
        if (url.indexOf('?') > 0) {
            url += '&' + query;
        } else {
            url += '?' + query;
        }
        window.location.href = url;
    });
	
	
});		
</script>
</block>